@extends('layouts.admin')

@section('scripts')
    <script src="{{asset('DatePicker/WdatePicker.js')}}" type="text/javascript"></script>
@stop

@section('content')
    <ol class="breadcrumb">
        <li class="breadcrumb-item">后台管理</li>
        <li class="breadcrumb-item">佣金管理</li>
        <li class="breadcrumb-item active">佣金提现</li>
    </ol>

    <div class="content-div">
        <form method="post" id="listForm">
            {{form_verify_field()}}
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="listtable">
                <thead>
                <tr>
                    <th width="20">选</th>
                    <th>会员账号</th>
                    <th>账户姓名</th>
                    <th>手机号</th>
                    <th width="100">开户行</th>
                    <th>收款账号</th>
                    <th width="140">提现金额</th>
                    <th width="80">状态</th>
                    <th width="80">申请日期</th>
                    <th width="80">操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($items as $item)
                <tr>
                    <td><input title="" type="checkbox" class="checkmark" name="delete[]" value="{{$item['id']}}" /></td>
                    <td><a>{{$item['user']['username']}}</a></td>
                    <td>{{$item['card']['name']}}</td>
                    <td>{{$item['card']['phone']}}</td>
                    <td>{{$item['card']['bank']}}</td>
                    <td>{{$item['card']['account_id']}}</td>
                    <td>{{$item['amount']}}</td>
                    <td>
                        @if ($item['status'] == 0)
                            审核中
                        @elseif ($item['status'] == 1)
                            已同意
                        @else
                            已拒绝
                        @endif
                    </td>
                    <td>{{@date('Y-m-d', $item['created_at'])}}</td>
                    <td><a href="{{admin_url('commission/showwithdraw?id='.$item['id'])}}">查看详情</a></td>
                </tr>
                @endforeach
                </tbody>
                <tfoot>
                <tr>
                    <td colspan="11">
                        <div class="float-right">{!! $pagination !!}</div>
                        <div class="btn-group-sm">
                            <label class="form-check-label"><input type="checkbox" class="checkmark" data-action="checkall"> {{trans('common.selectall')}}</label>
                            <button type="button" class="btn btn-default btn-action" disabled="disabled" id="batchdelete">批量删除</button>
                            <button type="button" class="btn btn-default" data-action="refresh">刷新</button>
                        </div>
                    </td>
                </tr>
                </tfoot>
            </table>
        </form>
    </div>
@stop

@section('foot')
    <script type="text/javascript">
        $(function () {
            $(document).on('click', function () {
                if ($(".checkmark:checked").length > 0){
                    $(".btn-action").enable();
                } else {
                    $(".btn-action").disable();
                }
            });

            $("#batchdelete").on('click', function () {
                DSXUI.showConfirm('确认要删除所选信息吗?', function () {
                    $("#listForm").ajaxSubmit({
                        url:'{{admin_url('commission/deletewithdraw')}}',
                        beforeSend:DSXUI.showSpinner,
                        success:function () {
                            setTimeout(function () {
                                DSXUI.hideSpinner();
                                DSXUtil.reFresh();
                            }, 500);
                        }
                    });
                });
            });
        });
    </script>
@stop
